class Solution {
public:
    bool canJump(vector<int>& nums) {
        int len = nums.size();
        int* arr = new int[len];
        arr[0] = 1;
        for (int i = 0; i < len; i++)
        {
            if (i == 0)
            {
                continue;
            }
            arr[i] = 0;
            for (int j = i - 1; j >= 0; j--)
            {
                if (arr[j] && nums[j] + j >= i)
                {
                    arr[i] = 1;
                    break;
                }
            }

        }
        return arr[len - 1];
    }
};